#!/bin/sh

echo "输入要的读的文件名"
read filename

if [ -f "$filename" ]; then 
#if [ -e "$filename" ]; then 
#	echo "存在"

filename_number=`wc $filename`
number=`echo $filename_number|awk '{print $1}'`
echo "$number"

echo "输入要的读的多少行,如果要全部输入则输入a"
read i

	if [ "$i" = "a" ]; then
		i=$number
	else
		i=$i
	fi

	if [ "$i" -gt "$number" ]; then
		echo "$i数字大于文件行数"
	else
		for((j=1;j<=$i;j++));do
#	ip=`awk 'NR==$j { print $0}' $filename`
#	ip=`echo "`awk '{if (NR==$j) print $1}' $filename`"`
	#ip=`echo $filename|awk '{if (NR==$j) print $1}' IPv6_Prefix_Btable`
	#echo "$ip"
#echo "$filename$j"

			ip=`awk '{if (NR==m) print $1}' m=$j $filename`
			echo "$ip"
		done
	fi

else
	echo "不存在"
fi


